const router = require('koa-router')();
//搜索
router.get('/search',async ctx => {
    let {key} = ctx.query;
    let data = await ctx.mysql.query(`select * from product_list where title like '%${key}%'`);
    if(data.msg === 'error'){
        ctx.body = {
            code:0,
            msg:'搜索失败'
        }
    }else{
        ctx.body = {
            code:1,
            data
        }
    }
})

module.exports = router